package com.wzz.seckillone.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzz.seckillone.common.PageInfoDTO;
import com.wzz.seckillone.mapper.SeckillGoodsMapper;
import com.wzz.seckillone.pojo.SeckillGoods;
import com.wzz.seckillone.service.SeckillGoodsService;
import com.wzz.seckillone.vo.SeckillGoodsWh;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-11-08
 */
@Service
@Transactional
public class SeckillGoodsServiceImpl extends ServiceImpl<SeckillGoodsMapper, SeckillGoods> implements SeckillGoodsService {

    @Autowired
    private SeckillGoodsMapper seckillGoodsMapper;
    /**
     * @Method
     * @Author wzz
     * @Version  1.0
     * @Description 分页查询秒杀商品信息
     * @param info
     * @Return
     * @Exception
     * @Date 2022/3/15 23:17
     */
    @Override
    public PageInfoDTO getSeckillGoodsList(PageInfoDTO info,String keyword) {
        PageInfoDTO dto = new PageInfoDTO();
        int count = seckillGoodsMapper.findSeckillGoodsCount();
        dto.setCount(count);
        List<SeckillGoodsWh> list = new ArrayList<>();
        if (count > 0){
            //list = seckillGoodsMapper.getSeckillGoodsList((info.getCurPage()-1)*info.getPerCount(),info.getPerCount(),keyword);
        }
        dto.setRetList(list);

        return dto;
    }

    @Override
    public SeckillGoods getSecKillGoodByGoodsId(String goodsId) {
        return seckillGoodsMapper.getSeckillGoodsByGoodsId(goodsId);
    }


}
